Line chart with scrolling effect
This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.line.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">
[No canvas support]
</canvas>
This is the code that generates the chart:
<script>
data = RGraph.array_pad([], 500);
function DrawGraph ()
{
RGraph.clear(document.getElementById("cvs"));
RGraph.ObjectRegistry.clear();
var line = new RGraph.Line({
id: 'cvs',
data: data,
options: {
colors: ['green'],
linewidth: 1,
filled: true,
fillstyle: 'rgba(128,255,128,0.5)',
ymax: 60,
tickmarks: null,
shadow: false,
numxticks: 5,
labels: ['Now','25s','50s','75s','100s','125s'],
backgroundGridAutofitNumvlines: 5,
textAccessible: true
}
}).draw();
r = RGraph.random(45,55);
data = [r].concat(data);
data.pop();
setTimeout(DrawGraph, 250);
}
window.onload = function ()
{
DrawGraph();
};
</script>